package com.eco.fanliapp.admin.controller.web;


import com.eco.fanliapp.admin.annotation.SysLogAnnotation;
import com.eco.fanliapp.admin.common.BaseController;
import com.eco.fanliapp.common.response.ServerResponse;
import com.eco.fanliapp.entity.SyTljGoodsfree;
import com.eco.fanliapp.service.*;
import com.eco.fanliapp.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;

@RestController
@RequestMapping("/web/taolijin")
public class SysTljGoodsfreeController extends BaseController {

    @Autowired
    private ISyTljGoodsfreeService syTljGoodsfreeService;

    /**
     * 查询tlj商品
     * @param pageNum
     * @param pageSize
     * @param date
     * @return
     */
    @GetMapping("/selectTljGoodsfree")
    public ServerResponse selectTljGoodsfree(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10")Integer pageSize, String date){
        return syTljGoodsfreeService.selectTljGoodsfree(pageNum,pageSize,date);
    }

    @PostMapping("/insertTljGoodsfree")
    public ServerResponse insertTljGoodsfree(@RequestBody SyTljGoodsfree syTljGoodsfree){
        UserVO authentication = getAuthentication();
        return syTljGoodsfreeService.insertTljGoodsfree(syTljGoodsfree,authentication);
    }

    @RequestMapping("/ishasItemId")
    public ServerResponse ishasItemId(Long itemId){
        return syTljGoodsfreeService.ishasItemId(itemId);
    }


    @GetMapping("/deleteTljGoodsfree")
    @SysLogAnnotation(value = "删除了淘礼金商品",userType = 2)
    public ServerResponse deleteTljGoodsfree(Integer tableId){
        return syTljGoodsfreeService.deleteTljGoodsfree(tableId) ;
    }

}
